import warnings

from base.util.common_util import send_notice
from mapping.mapping import generate_mapping
from package.package import get_package
from sample.sample import handle_sample
from session.get_dangerous_session import get_all_dangerous_session
from session.session import get_session
from set_label.set_label import set_label
from base.util.file_util import get_config, create_folders

if __name__ == '__main__':
    warnings.filterwarnings('ignore')
    config_yaml, config_file = get_config()
    create_folders()
    if config_yaml['session']['allTrue']:
        get_all_dangerous_session(config_yaml=config_yaml)
    else:
        get_session(config_yaml=config_yaml)
    sample = handle_sample(config_yaml=config_yaml)
    get_package(config_yaml=config_yaml, sample=sample)
    set_label(config_yaml=config_yaml)
    generate_mapping(config_yaml=config_yaml)
    config_file.close()
    send_notice(config_yaml['notice_content'])
